//package com.moxiao.yfjh.module.blind.common;
//
//import cn.hutool.core.map.MapUtil;
//import com.moxiao.yfjh.framework.common.pojo.PageResult;
//import com.moxiao.yfjh.module.blind.controller.admin.user.BlindBrokerageUserRespVO;
//import com.moxiao.yfjh.module.blind.dal.dataobject.brokerageUser.BlindBrokerageUserDO;
//import com.moxiao.yfjh.module.member.api.user.dto.MemberUserRespDTO;
//import org.mapstruct.Mapper;
//import org.mapstruct.factory.Mappers;
//
//import java.util.List;
//import java.util.Map;
//import java.util.Optional;
//
///**
// * 分销用户 Convert
// *
// * @author owen
// */
//@Mapper
//public interface BlindBrokerageUserConvert {
//
//    BlindBrokerageUserConvert INSTANCE = Mappers.getMapper(BlindBrokerageUserConvert.class);
//
//    BlindBrokerageUserRespVO convert(BlindBrokerageUserDO bean);
//
//    List<BlindBrokerageUserRespVO> convertList(List<BlindBrokerageUserDO> list);
//
//    default PageResult<BlindBrokerageUserRespVO> convertPage(PageResult<BlindBrokerageUserDO> pageResult,
//                                                             Map<Long, MemberUserRespDTO> userMap,
//                                                             Map<Long, Long> brokerageUserCountMap) {
//        PageResult<BlindBrokerageUserRespVO> result = convertPage(pageResult, userMap, brokerageUserCountMap);
//        for (BlindBrokerageUserRespVO userVO : result.getList()) {
//            // 推广用户数量
//            userVO.setBrokerageUserCount(MapUtil.getInt(brokerageUserCountMap, userVO.getId(), 0));
//        }
//        return result;
//    }
//
//    default BlindBrokerageUserRespVO copyTo(MemberUserRespDTO source, BlindBrokerageUserRespVO target) {
//        Optional.ofNullable(source).ifPresent(
//                user -> target.setNickname(user.getNickname()).setAvatar(user.getAvatar()));
//        return target;
//    }
//
//}
